import address from "@/pages/address"
import addressEdit from "@/pages/address/edit"
import cart from "@/pages/cart"
import commit from "@/pages/commit"
import detail from "@/pages/detail"
import notice from "@/pages/notice"
import type from "@/pages/type"
import main from "@/pages/main"
import order from "@/pages/order"
import orderDetail from "@/pages/order/detail"
import goods from "@/pages/goods"
import my from "@/pages/my"
import user from "@/pages/user"
import userInfo from "@/pages/user/info"
import transferAccount from "@/pages/transfer/account"
import transferGoods from "@/pages/transfer/goods"
import store from "@/pages/store"
import share from "@/pages/share"
import out from "@/pages/login/out"
import login from "@/pages/login"
import accountRecord from "@/pages/account/record"
import payment from "@/pages/account/payment"
import card from "@/pages/course/card"
import code from "@/pages/code"
import scan from "@/pages/scan"
import sign from "@/pages/course/sign"
import pointSign from "@/pages/sign"
import edit from "@/pages/my/edit"
import confirm from "@/pages/course/confirm"
import charge from "@/pages/transfer/charge"
import typeList from "@/pages/type/list"
import commission from "@/pages/commission/index"
import received from "@/pages/order/received"
import VueRouter from 'vue-router'
import auth from '@/pages/auth'
import form from '@/pages/goodsForm'
import manage from '@/pages/goodsmanage'
import freight from "@/pages/goodsForm/freight"
import demo from "@/pages/home/demo"
import freightEdit from "@/pages/goodsForm/freightEdit"
import comment from "@/pages/goodsmanage/comment"
import bulkManage from "../pages/goodsmanage/bulkManage"
import goodslist from "@/pages/goodslist"
import classify from '@/pages/type/class'
import deposit from '@/pages/transfer/deposit'
import logistics from '@/pages/order/logistics'
import withdrawOld from "@/pages/order/withdraw"
import withdraw from "@/pages/withdraw"
import bank from "@/pages/withdraw/bank"
import withdrawEdit from '@/pages/withdraw/edit'
import lottery from "../pages/my/lottery";
//不同首页
let home
if(process.env.VUE_APP_NAME == 'wg'){
    home = () => import('@/pages/home')
}else{
    home = () => import('@/pages/home/demo')
}
const routes = [
    {
        path: "/login",
        component: login
    },
    {
        path: "/out",
        component: out
    },
    {
        path: "",
        component: main,
        redirect: '/home',
        children: [
            {
                path: "/account/record",
                component: accountRecord
            },
            {
                path: "/scan",
                component: scan
            },
            {
                path: "/auth",
                component: auth
            },
            {
                path: "/user",
                component: user
            },
            {
                path: "/code",
                component: code
            },
            {
                path: "/sign",
                component: sign,
                meta: {
                    notAlive: true
                }
            },
            {
                path: "/point/sign",
                component: pointSign,
            },
            {
                path: "/account/charge",
                component: charge,
                meta: {
                    notAlive: true
                }
            },{
                path: "/account/deposit",
                component: deposit,
                meta: {
                    notAlive: true
                }
            },
            {
                path: "/confirm",
                component: confirm
            },
            {
                path: "/card",
                component: card
            },
            {
                path: "/store",
                component: store
            },
            {
                path: "/account/payment",
                component: payment
            },

            {
                path: "/share",
                component: share
            },
            {
                path: "/transfer/account",
                component: transferAccount
            },
            {
                path: "/transfer/goods",
                component: transferGoods
            },
            {
                path: "/user/info",
                component: userInfo
            },
            {
                path: "/home",
                component: home
            },
            {
                path: "/my",
                component: my
            },
            {
                path: "/my/edit",
                component: edit
            },
            {
                path: "/order",
                component: order
            },
            {
                path: "/goods",
                component: goods
            },
            {
                path: "/order/detail",
                component: orderDetail
            },
            {
                path: "/detail",
                component: detail
            },
            {
                path: "/address",
                component: address
            },
            {
                path: "/address/edit",
                component: addressEdit
            },
            {
                path: "/cart",
                component: cart
            },
            {
                path: "/commit",
                component: commit
            },

            {
                path: "/notice",
                component: notice
            },
            {
                path: "/type",
                component: type

            }, {
                path: "/type/list",
                component: typeList
            }, {
                path: "/commission",
                component: commission
            }, {
                path: "/received",
                component: received
            },{
                path:'/form',
                component: form
            },{
                path:'/manage',
                component: manage
            },{
                path : '/freight',
                component : freight
            },
            // {
            //     path : '/demo',
            //     component : demo
            // },
            {
                path : '/freight/edit',
                component : freightEdit
            },{
                path : '/manage/comment',
                component : comment
            },{
                path : '/manage/bulk',
                component : bulkManage
            },{
                path : '/goodslist',
                component : goodslist
            },{
                path : '/type/classify',
                component : classify
            },{
                path : '/order/logistics',
                component : logistics
            },{
                path : '/order/withdraw',
                component : withdrawOld
            }
            ,{
                path : '/withdraw',
                component : withdraw
            },{
                path : '/withdraw/bank',
                component : bank
            }
            ,{
                path : '/withdraw/edit',
                component : withdrawEdit
            },{
                path : '/lottery',
                component : lottery
            }

        ]
    }
]

const router = new VueRouter({
    base: process.env.NODE_ENV === 'production'
        ? process.env.VUE_APP_HEAD
        : '/',
    mode: 'history',
    routes: routes,
    scrollBehavior(to, from, savedPosition) {
        return {x: 0, y: 0}
    }
})

export default router

